Currency Converter

This Template was Downloaded From GrabTemplates.com

Created: 21/09/2009
By: Sitebase
Email: wim@sitebase.be
Thank you for purchasing my script. If you have any questions that are beyond the scope of this help file, please feel free to email via my user page contact form here. Thanks so much!

Table of Contents

  1. Features
  2. How to use
  3. Cache data

A. Features

This PHP class is a multilingual currency converter for over 80 currencies. It uses daily updated exchange rates so the conversions are always correct. This class can for example be used in an online shop to automatic convert prizes of your products to an other currencie.

Below you find a list of supported currencies:

B. How to use

Extract all the files form the zip. The file you need to include in your script is CurrencyConverter.php. Next thing to do is create an instance of this class.

This Template was Downloaded From GrabTemplates.com

include("CurrencyConverter.php");
$CurrencyConverter = new CurrencyConverter();

If you want to convert euro's to dollar's you need the shorttag's for this currencies. This shorttags can be found in the list under the features categorie. For euro's is this EUR and for dollar's is this USD.

Now we can use the Convert method to do the calculation. The method Convert accepts 3 parameters. The first parameter is the source currency, second parameter is the destination currency and the last parameter is the value you want to convert.

This Template was Downloaded From GrabTemplates.com

echo $CurrencyConverter->Convert("EUR", "USD", 500);

 

C. Cache data

If you want you can eneable caching so the data is stored once a day in a local file. This will reduce the page load time and server load. To eneable caching you add a filename to the constructor.

This Template was Downloaded From GrabTemplates.com

$CurrencyConverter = new CurrencyConverter('mycachefile.tmp');